package com.itheima.reggie.common;

/**
 * 基于ThreadLocal封装工具类,在获取不到session的情况下,用线程的set、get方法保存用户的id,在增、改的情况下记录历史情况
 * @author solang
 *  @date 2022-12-26 14:50
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
